package com.huizu.project.apiController;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.huizu.common.annotation.Anonymous;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.core.page.TableDataInfo;
import com.huizu.common.enums.BusinessType;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.project.domain.ProConfigRich;
import com.huizu.project.service.IProConfigRichService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 通用协议配置Controller
 * 
 * @author zhangmx
 * @date 2024-06-05
 */
@Anonymous
@RestController
@RequestMapping("/api/proconfigrich")
public class ApiProConfigRichController extends BaseController
{
    @Autowired
    private IProConfigRichService proConfigRichService;


    /**
     * 获取通用协议配置详细信息
     */
    @PostMapping(value = "/getById")
    public AjaxResult getInfo(@RequestBody ProConfigRich proConfigRich)
    {
        String id = proConfigRich.getId();
        return success(proConfigRichService.selectProConfigRichByConfigurationId(id));
    }

    @GetMapping("/getByName")
    public AjaxResult getByName(@Param("name") String name)

    {
        ProConfigRich proConfigRich = new ProConfigRich();
        proConfigRich.setConfigurationName(name);
        ProConfigRich rich = null;
        List<ProConfigRich> list = proConfigRichService.selectProConfigRichList(proConfigRich);
        if (CollUtil.isNotEmpty(list)){
              rich =list.get(0);
        }
        return success(rich);
    }


}
